package com.spzx.payment.controller;

import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.payment.service.IAlipayService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author: atguigu
 * @create: 2025-02-28 14:37
 */
@RestController
@RequestMapping("/alipay")
public class AlipayController {

    @Autowired
    private IAlipayService alipayService;

    @Operation(summary = "对接支付宝返回支付表单")
    @RequestMapping("/submitAlipay/{orderNo}")
    public AjaxResult submitAlipay(@PathVariable("orderNo") String orderNo) {
        String payFormStr = alipayService.submitAlipay(orderNo);
        return AjaxResult.success(payFormStr);
    }



    @Operation(summary = "用户付款成功后，支付宝调用该接口通知商户系统支付结果")
    @PostMapping("/callback/notify")
    public String paySucessNotify(@RequestParam Map<String, String> paramsMap){
        String result = alipayService.paySucessNotify(paramsMap);
        return result;
    }
}
